﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using Axiom.Math;
namespace w4nted
{
    [Serializable()]
    class player
    {
        public player(IPEndPoint ip)
        {
            host_ep = ip;
        }
        public player(player p)
        {
            host_ep = p.host_ep;
            position = p.position;
            orientation = p.orientation;
            name = p.name;
            hp = p.hp;
            start_time = p.start_time;
            id = p.id;

        }

        internal IPEndPoint host_ep;
        internal Vector3Serialized position = new Vector3Serialized();
        internal QuaternionSerialized orientation = new QuaternionSerialized();
        internal String name;
        internal short hp;
        internal DateTime start_time = new DateTime();
        internal byte id = 1;
        internal Boolean created = false;
        
    }

    #region Serialize Object-Implementations
    [Serializable()]
    class Vector3Serialized
    {
        public float x;
        public float y;
        public float z;
        public Vector3 ToVector3()
        {
            return new Vector3(x, y, z);
        }
        public void SetVector(Vector3 v)
        {
            x = v.x;
            y = v.y;
            z = v.z;
        }

    }

    [Serializable()]
    class QuaternionSerialized
    {
        public float w;
        public float x;
        public float y;
        public float z;

        public Quaternion ToQuanternion()
        {
            return new Quaternion(w, x, y, z);
        }
        public void SetQuanternion(Quaternion q)
        {
            w = q.w;
            x = q.x;
            y = q.y;
            z = q.z;
        }

    }
    #endregion

}
